package cn.iocoder.yudao.module.member.statistics.controller.app;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.member.statistics.pojo.vo.AppMemberCenterSummaryRespVO;
import cn.iocoder.yudao.module.member.statistics.service.MemberStatisticsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;


@Tag(name = "用户 App - 个人中心统计")
@RestController
@RequestMapping("/statistics/mine")
@Validated
@Deprecated
public class AppMemberStatisticsController {

    @Resource
    private MemberStatisticsService memberStatisticsService;

    @GetMapping("/count")
    @Operation(summary = "获得数据汇总", deprecated = true, description = "使用`/member/statistics/center-count`代替")
    @PermitAll
    @Deprecated
    public CommonResult<AppMemberCenterSummaryRespVO> getCount() {
        AppMemberCenterSummaryRespVO respVO = memberStatisticsService.getMemberCenterSummaryAndSyncToRedis(getLoginUserId());
        return success(respVO);
    }

}
